package com.lihepeng.leecode.juc;

public class FooTest {
    void first(){
        System.out.println(1);
    }
    void second(){
        System.out.println(2);
    }
    void third(){
        System.out.println(3);
    }

    public static void main(String[] args) {
        FooTest fooTest = new FooTest();


       Thread t1 =  new Thread(()->{
            fooTest.first();
        });

        Thread t3 = new Thread(() -> {
            try {
                t1.join();
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            fooTest.third();
        });
        Thread t2 = new Thread(() -> {
            try {
                t3.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            fooTest.second();
        });
        t1.start();
        t2.start();
        t3.start();


    }
}
